import java.awt.BorderLayout;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import javax.swing.BorderFactory;
import javax.swing.ComboBoxModel;
import javax.swing.DefaultComboBoxModel;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.JToolBar;

import javax.swing.WindowConstants;
import javax.swing.border.BevelBorder;
import javax.swing.SwingUtilities;

import javax.swing.JFileChooser;
import java.io.File;

/**
* This code was edited or generated using CloudGarden's Jigloo
* SWT/Swing GUI Builder, which is free for non-commercial
* use. If Jigloo is being used commercially (ie, by a corporation,
* company or business for any purpose whatever) then you
* should purchase a license for each developer using Jigloo.
* Please visit www.cloudgarden.com for details.
* Use of Jigloo implies acceptance of these licensing terms.
* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
* THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
* LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
*/
public class NewJFrame extends javax.swing.JFrame {
	private JLabel jLabel1;
	private JToolBar jToolBar1;
	private JButton jButton1;
	private JLabel jLabel5;
	private JComboBox jComboBox1;
	private JButton jButton5;
	private JButton jButton4;
	private JButton jButton2;
	private JTextField jTextField2;
	private JTextField jTextField1;
	private JLabel jLabel4;
	private JLabel jLabel3;
	private JLabel jLabel2;
	private JButton jButton3;
	private JPanel jPanel1;

	/**
	* Auto-generated main method to display this JFrame
	*/
	public static void main(String[] args) {
		SwingUtilities.invokeLater(new Runnable() {
			public void run() {
				NewJFrame inst = new NewJFrame();
				inst.setLocationRelativeTo(null);
				inst.setVisible(true);
			}
		});
	}
	
	public NewJFrame() {
		super();
		initGUI();
	}
	
	private void initGUI() {
		try {
			setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
			this.setTitle("Ficha Alumno");
			BorderLayout thisLayout = new BorderLayout();
			getContentPane().setLayout(thisLayout);
			this.setIconImage(new ImageIcon(getClass().getClassLoader().getResource("img/iconoTitulo.gif")).getImage());
			{
				jLabel1 = new JLabel();
				getContentPane().add(jLabel1, BorderLayout.SOUTH);
				jLabel1.setText("Estado de la aplicacion");
				jLabel1.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED));
			}
			{
				jToolBar1 = new JToolBar();
				getContentPane().add(jToolBar1, BorderLayout.NORTH);
				jToolBar1.setPreferredSize(new java.awt.Dimension(553, 30));
				{
					jButton1 = new JButton();
					jToolBar1.add(jButton1);
					jButton1.setIcon(new ImageIcon(getClass().getClassLoader().getResource("img/save.gif")));
					jButton1.addActionListener(new ActionListener() {
						public void actionPerformed(ActionEvent evt) {
							jButton2ActionPerformed(evt);
						}
					});
				}
			}
			{
				jPanel1 = new JPanel();
				jPanel1.setLayout(null);
				getContentPane().add(jPanel1, BorderLayout.EAST);
				jPanel1.setPreferredSize(new java.awt.Dimension(550, 323));
				{
					jButton3 = new JButton();
					jPanel1.add(jButton3);
					jButton3.setText("Salir");
					jButton3.setBounds(358, 170, 91, 23);
					jButton3.addActionListener(new ActionListener() {
						public void actionPerformed(ActionEvent evt) {
							System.out.println("jButton3.actionPerformed, event="+evt);
							//TODO add your code for jButton3.actionPerformed
							System.exit(0);
						}
					});
				}
				{
					jLabel2 = new JLabel();
					jPanel1.add(jLabel2);
					jLabel2.setText("Nombre");
					jLabel2.setBounds(152, 23, 82, 16);
				}
				{
					jLabel3 = new JLabel();
					jPanel1.add(jLabel3);
					jLabel3.setText("Apellidos");
					jLabel3.setBounds(152, 61, 82, 16);
				}
				{
					jLabel4 = new JLabel();
					jPanel1.add(jLabel4);
					jLabel4.setText("Provincia");
					jLabel4.setBounds(152, 107, 87, 16);
				}
				{
					jTextField1 = new JTextField();
					jPanel1.add(jTextField1);
					jTextField1.setBounds(252, 20, 91, 23);
				}
				{
					jTextField2 = new JTextField();
					jPanel1.add(jTextField2);
					jTextField2.setBounds(252, 58, 91, 23);
				}
				{
					jButton2 = new JButton();
					jPanel1.add(jButton2);
					jButton2.setText("Guardar");
					jButton2.setIcon(new ImageIcon(getClass().getClassLoader().getResource("img/save.gif")));
					jButton2.setBounds(216, 165, 111, 23);
					jButton2.addActionListener(new ActionListener() {
						public void actionPerformed(ActionEvent evt) {
							jButton2ActionPerformed(evt);
						}
					});
				}
				{
					jButton4 = new JButton();
					jPanel1.add(jButton4);
					jButton4.setIcon(new ImageIcon(getClass().getClassLoader().getResource("img/imagen1.gif")));
					jButton4.setBounds(121, 193, 62, 55);
					jButton4.addMouseListener(new MouseAdapter() {
						public void mouseExited(MouseEvent evt) {
							System.out.println("jButton4.mouseExited, event="+evt);
							//TODO add your code for jButton4.mouseExited
							jButton4.setIcon(new ImageIcon(getClass().getClassLoader().getResource("img/imagen1.gif")));
						}
						public void mouseEntered(MouseEvent evt) {
							System.out.println("jButton4.mouseEntered, event="+evt);
							//TODO add your code for jButton4.mouseEntered
							jButton4.setIcon(new ImageIcon(getClass().getClassLoader().getResource("img/imagen2.gif")));
									
						}
					});
				}
				{
					jLabel5 = new JLabel();
					jPanel1.add(jLabel5);
					jLabel5.setBounds(15, 18, 87, 105);
					jLabel5.setBorder(BorderFactory.createEtchedBorder(BevelBorder.LOWERED));
				}
				{
					jButton5 = new JButton();
					jPanel1.add(jButton5);
					jButton5.setText("Cargar foto");
					jButton5.setBounds(20, 147, 120, 23);
					jButton5.addActionListener(new ActionListener() {
						public void actionPerformed(ActionEvent evt) {
							jButton5ActionPerformed(evt);
						}
					});
				}
				{
					ComboBoxModel jComboBox1Model = 
							new DefaultComboBoxModel(
									new String[] { "Toledo", "Ciudad Real","Cuenca" });
					jComboBox1 = new JComboBox();
					jPanel1.add(jComboBox1);
					jComboBox1.setModel(jComboBox1Model);
					jComboBox1.setBounds(257, 104, 91, 23);
					jComboBox1.setToolTipText("Pulsa para desplegar opciones");
				}
			}
			pack();
			this.setSize(569, 411);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	
	private void jButton2ActionPerformed(ActionEvent evt) {
		System.out.println("jButton2.actionPerformed, event="+evt);
		//TODO add your code for jButton2.actionPerformed
		jLabel1.setText("Guardando...");
		JOptionPane.showMessageDialog(this, "guardado informacion");
		
		
		
	}
	
	private void jButton5ActionPerformed(ActionEvent evt) {
		System.out.println("jButton5.actionPerformed, event="+evt);
		//TODO add your code for jButton5.actionPerformed
		JFileChooser fcAbrir = new JFileChooser();
		int valorDevuelto = fcAbrir.showOpenDialog(this);
		if (valorDevuelto == JFileChooser.APPROVE_OPTION) {
		File file = fcAbrir.getSelectedFile();
		jLabel5.setIcon(new ImageIcon(file.getAbsolutePath()));
		}
	}

}
